//
//  HotBrainStormViewController.m
//  Gxj
//
//  Created by 刘伟 on 2017/9/6.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "HotBrainStormViewController.h"
#import "ExcellentideaViewController.h"
#import "HighqualityimaginationViewController.h"

@interface HotBrainStormViewController ()<SGPageTitleViewDelegate, SGPageContentViewDelegate>



@property (nonatomic, strong) SGPageTitleView *pageTitleView;//
@property (nonatomic, strong) SGPageContentView *pageContentView;


@end

@implementation HotBrainStormViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self showHotBrainStormVC];
    //顶部滑动条
    [self setTopView];
}

- (void)showHotBrainStormVC
{
    self.title = @"热门创想";
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"tbg"]forBarMetrics:UIBarMetricsDefault];
    
    self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
    
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:17]};
    
    //导航条左边按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"fanhui1"] style:UIBarButtonItemStyleDone target:self action:@selector(clickLeftBarButton)];
    //导航条右边按钮
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"fenlei"] style:UIBarButtonItemStyleDone target:self action:@selector(clickRightButton)];
}
//导航条返回按钮响应
- (void)clickLeftBarButton
{
    [self.navigationController popViewControllerAnimated:YES];
}
//导航条右边按钮响应
- (void)clickRightButton
{
    
}
- (void)setTopView
{
    //优质会议
    HighqualityimaginationViewController * bianlunView=[[HighqualityimaginationViewController alloc] init];
    //卓越会议
    ExcellentideaViewController * meetingView=[[ExcellentideaViewController alloc] init];
    
    NSArray *childArr = @[bianlunView,meetingView];
    /// pageContentView
    CGFloat contentViewHeight = self.view.frame.size.height ;
    self.pageContentView = [[SGPageContentView alloc] initWithFrame:CGRectMake(0, kHeightScale(0), self.view.frame.size.width, contentViewHeight) parentVC:self childVCs:childArr];
    _pageContentView.delegatePageContentView = self;
    // _pageContentView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bggray"]];
    [self.view addSubview:_pageContentView];
    NSArray *titleArr = @[@"优质创想", @"卓越创想"];
    /// pageTitleView
    self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, kHeightScale(0), self.view.frame.size.width, kHeightScale(36)) delegate:self titleNames:titleArr];
    [self.view addSubview:_pageTitleView];
    _pageTitleView.backgroundColor=[UIColor colorWithRed:(242.0/255) green:(242.0/255) blue:(242.0/255) alpha:1];
    _pageTitleView.selectedIndex = 0;
    _pageTitleView.titleColorStateNormal = [UIColor lightGrayColor];
    _pageTitleView.titleColorStateSelected = [UIColor blackColor];
    _pageTitleView.indicatorColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"huadongtiao"]];
    _pageTitleView.indicatorLengthStyle = SGIndicatorLengthStyleEqual;
    _pageTitleView.isShowBottomSeparator = NO;
}
- (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex {
    [self.pageContentView setPageCententViewCurrentIndex:selectedIndex];
}

- (void)pageContentView:(SGPageContentView *)pageContentView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex {
    [self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex];
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/



@end
